<template>
  <div id="system-item">
    <div class="column centered">
      <div class="time-str">{{timeStr}}</div>
      <div class="content-box">
        <div class="title text-ellipsis">{{info.title}}</div>
        <div class="content">{{info.content}}</div>
      </div>
    </div>
  </div>
</template>

<script>
import '@/assets/svgs/wdqb-more.svg';
import { Icon } from 'mand-mobile';
var moment = require('moment');
moment.locale('zh-cn');
export default {
  name: 'allot-item',
  components: {
    [Icon.name]: Icon
  },
  props: {
    info: {
      type: Object,
      default: () => {
        return {
          content: '',
          date: '',
          id: '',
          img: '',
          img_alt: '',
          status: '',
          title: '',
          url: ''
        };
      }
    }
  },
  computed: {
    timeStr() {
      let str = '';
      let mom = moment(this.info.date, 'x');
      str = mom.calendar(null, {
        sameDay: '[今天] HH:mm',
        nextDay: '[明天] HH:mm',
        nextWeek: 'dddd HH:mm',
        lastDay: '[昨天] HH:mm',
        lastWeek: '[上] ddd  HH:mm',
        sameElse: 'MMMDo  HH:mm'
      });
      return str;
    }
  }
};
</script>

<style lang="stylus" scoped>
#system-item {
  padding: 20px;

  .time-str {
    font-size: 24px;
    font-weight: 400;
    color: rgba(102, 102, 102, 1);
    line-height: 34px;
    margin-bottom: 20px;
  }

  .content-box {
    background: #fff;
    border-radius: 10px;
    padding: 20px;

    .title {
      font-size: 30px;
      font-weight: 400;
      line-height: 42px;
      margin: 10px 0px;
      max-width: 670px;
    }

    .content {
      min-width: 670px;
      font-size: 26px;
      font-weight: 400;
      color: rgba(153, 153, 153, 1);
      line-height: 36px;
    }
  }
}
</style>
